package paixv;

public class ErFenSearch {
	public static void find(int left, int right, int val, int arr[]) {
		int mid = (left + right) / 2;
		int midValue = arr[mid];
		if (right >= left) {
			if (midValue > val)
				find(left, mid - 1, val, arr);
			else if (midValue < val)
				find(mid + 1, right, val, arr);
			else if (midValue == val)
				System.out.println("下标" + mid);
		}
	}

	public static void main(String[] args) {
		int arr[] = { 2, 14, 35, 47, 78, 167, 236 };
		find(0, arr.length - 1, 167, arr);
	}

}
